// File: progress_bar.cpp
// Author: Sergey Pershin <sergey dot pershin at hotmail dot com>

#include <stdio.h>
#include "progress_bar.h"

void ProgressBar::show(long int i, long int fileSize)
{
    if (i == 0) {
        printf( "          0%%           50%%           100%%\n"
            "Progress: " );
    } else {
        if (j_ != k_) {
            putchar(0xFE);
            fflush(stdout);
            j_ = k_;
        }
        k_ = i * 31 / fileSize;
    }
}
